package com.jxlg.web;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
public class Hell {

    /**
     *
     *
     *http://127.0.0.1:8080/revice?name=lisi&age=12
     */
    @GetMapping("/revice")
    public String revice(String name,int age)
    {
        System.out.println(name + "---->" +age);
        return "数据已经收到！";
    }

    /**
     *
     * http://127.0.0.1:8080/r?name=lisi&age=12
     */
    @PostMapping("/r")
    public String rr(String name ,int age)
    {
        System.out.println(name + "---->"+age);
        return "lalalla!";
    }


    @PostMapping("/stu")
    public String stud(@RequestBody Student s)
    {
        System.out.println(s);
        return "data over!";
    }

    @PostMapping("/stus")
    public List<Student>  stus(int id)
    {
        System.out.println(id);
        List<Student> list = new ArrayList<>();
        list.add(new Student(1,"wangjx","men",120));
        list.add(new Student(2,"is","man",100));
        list.add(new Student(2,"shab","man",100));
        return list;
    }
}
